new Vue({
    el:".container",
    mounted:function () {
        this.$nextTick(function () {
            this.showAddress();
        })
    },
    data:{
        addressList:[],
        addressLimit:3,
        currentIndex:0,
        shippingMethod:1
    },
    filters:{
    },
    computed:{
        filterAddress:function () {
            return this.addressList.slice(0,this.addressLimit);
        }
    },
    methods:{
        showAddress:function () {
            var _this=this;
            this.$http.get("/data/json/address.json").then(function (res) {
                var data=res.data;
                if (data.status===0){
                    _this.addressList=data.result;
                }else {
                    alert(data.message);
                }
                console.log(_this.showAddress)
            })
        },
        loadMore:function () {
            if (this.addressLimit<this.addressList.length){
                this.addressLimit=this.addressList.length;
            }else {
                this.addressLimit=3;
            }

        },
        setDefault:function (addressId) {
            this.addressList.forEach(function (address,index) {
                if (addressId===address.addressId){
                    address.isDefault=true;
                }else{
                    address.isDefault=false;
                }
            })
        }
    }

})